//
//  FR_MessageListCell.m
//  FaceRecognition
//
//  Created by Sylar on 2017/7/10.
//  Copyright © 2017年 Sylar. All rights reserved.
//

#import "FR_MessageListCell.h"

@implementation FR_MessageListCell
{
    UILabel *titleLabel;
    UILabel *dateLabel;
    UILabel *contentLabel;
    UILabel *checkLabel;
    UIImageView *unreadImg;//未读标识
    
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self.contentView setBackgroundColor:colorFromHex(@"f4f5f7")];
        
        UIView *back = [[UIView alloc]initWithFrame:CGRectMake(15, 16, SCREENWIDTH-30, 115)];
        back.layer.cornerRadius = 4.0;
        [back setBackgroundColor:[UIColor whiteColor]];
        [self.contentView addSubview:back];
        
        titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(12, 12, 150, 17)];
        [titleLabel setTextColor:colorFromHex(@"000000")];
        [titleLabel setFont:[UIFont systemFontOfSize:17]];
        [back addSubview:titleLabel];
        
        dateLabel = [[UILabel alloc]initWithFrame:CGRectMake(back.width - 162, 12, 150, 14)];
        [dateLabel setTextColor:colorFromHex(@"787878")];
        [dateLabel setFont:[UIFont systemFontOfSize:14]];
        [dateLabel setTextAlignment:NSTextAlignmentRight];
        [back addSubview:dateLabel];
        
        contentLabel = [[UILabel alloc]initWithFrame:CGRectMake(12, titleLabel.bottom+15, back.width-24, 36)];
        [contentLabel setTextColor:colorFromHex(@"979797")];
        [contentLabel setFont:[UIFont systemFontOfSize:15]];
        contentLabel.numberOfLines = 0;
        contentLabel.lineBreakMode = NSLineBreakByCharWrapping;
        [back addSubview:contentLabel];
        
        checkLabel = [[UILabel alloc]initWithFrame:CGRectMake(back.width - 100, back.height-25, 88, 13)];
        [checkLabel setTextColor:colorFromHex(@"1098f7")];
        [checkLabel setFont:[UIFont systemFontOfSize:13]];
        [checkLabel setTextAlignment:NSTextAlignmentRight];
        [checkLabel setText:@"立即查看"];
        [back addSubview:checkLabel];
        
        unreadImg = [[UIImageView alloc] initWithFrame:CGRectMake(1.5, 16, 9, 9)];
        [unreadImg setImage:[UIImage imageNamed:@"home_circlered_"]];
        unreadImg.hidden = YES;
        [back addSubview:unreadImg];
        
        
    }
    return self;
}

- (void)creatCell:(SY_Activity_Model *)model {
    
    titleLabel.text = model.msgtitle;
    contentLabel.text = model.description2;
    dateLabel.text = model.jointime;
    unreadImg.hidden = model.readState;
   
   if (model.moveto >= 25 && model.moveto <= 33 ) {
      
      checkLabel.hidden = YES;
   }else{
      checkLabel.hidden = NO;
   }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    
}

@end
